package cz.movie.subRenamer.model;

import java.util.LinkedList;
import java.util.List;

/**
 * @author David
 * 
 */
public class LanguageSupport {

	private String properName;
	private List<String> otherNames = new LinkedList<String>();

	public String getProperName() {
		return properName;
	}

	public void setProperName(String properName) {
		this.properName = properName;
	}

	public List<String> getOtherNames() {
		return otherNames;
	}

	public void setOtherNames(List<String> otherNames) {
		this.otherNames = otherNames;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Language [properName=" + properName + ", otherNames={");
		for (String s : otherNames) {
			sb.append(s + ",");
		}
		if (!otherNames.isEmpty()) {
			sb.deleteCharAt(sb.length() - 1);
		}
		sb.append("}]");
		return sb.toString();
	}

	public boolean isStringInLang(String s) {
		if (properName.equalsIgnoreCase(s)) {
			return true;
		}
		for (String altLang : otherNames) {
			if (altLang.equalsIgnoreCase(s)) {
				return true;
			}
		}
		return false;
	}

}
